package com.xxh.springclouddemo.nacos.controller;


import com.xxh.springclouddemo.common.pojo.Student;
import com.xxh.springclouddemo.nacos.config.NacosConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author xxh
 * @Date 2024/4/3 21:29
 */

@RestController
public class StudentController {

    @Autowired
    private NacosConfig nacosConfig;


    @RequestMapping("/getStudent")
    public List<Student> getStudent(){
        List<Student> studentList = new ArrayList<>();

        for (int i = 0; i < 5; i++) {
            Student student = new Student();
            student.setAge(i);
            student.setName("名字"+i);
          studentList.add(student);
        }
        studentList.add(new Student(nacosConfig.getName(),100));

        return studentList;

    }
}
